<!DOCTYPE html>
<html lang="en">
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>添加客户</title>

    <meta name="pragma" content="no-cache">
    <meta name="cache-control" content="no-cache">
    <meta name="content-type" content="text/html;charset=UTF-8">
    <meta name="expires" content="0">
    <link href="/static/easyui/themes/insdep/easyui.css" rel="stylesheet" type="text/css">
    <link href="/static/easyui/themes/insdep/easyui_animation.css" rel="stylesheet" type="text/css">
    <link href="/static/easyui/themes/insdep/easyui_plus.css" rel="stylesheet" type="text/css">
    <link href="/static/easyui/themes/insdep/insdep_theme_default.css" rel="stylesheet" type="text/css">
    <link href="/static/easyui/themes/insdep/icon.css" rel="stylesheet" type="text/css">
    <link href="/static/easyui/themes/color.css" rel="stylesheet" type="text/css">

    <link href="/static/ztree/zTreeStyle/zTreeStyle.css" rel="stylesheet" type="text/css" >
    <link href="/static/css/common.css" rel="stylesheet" type="text/css" >

    <script type="text/javascript" src="/static/jquery/jquery.min.js"></script>
    <script type="text/javascript" src="/static/easyui/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="/static/easyui/themes/insdep/jquery.insdep-extend.min.js"></script>
    <script type="text/javascript" src="/static/ztree/jquery.ztree.all.min.js"></script>
    <script type="text/javascript" src="/static/easyui/easyui-lang-zh_CN.js"></script>
    <script type="text/javascript" src="/static/kindeditor/kindeditor-all-min.js"></script>
    <link href="http://www.easyui-extlib.com/Content/Site.css" rel="stylesheet" />
    <script src="http://www.easyui-extlib.com/Scripts/jquery-extensions/jquery.jdirk.js"></script>
    <link href="http://www.easyui-extlib.com/Scripts/jquery-easyui-extensions/validatebox/jeasyui.extensions.validatebox.css" rel="stylesheet" />
    <script src="http://www.easyui-extlib.com/Scripts/jquery-easyui-extensions/validatebox/jeasyui.extensions.validatebox.rules.js"></script>
</head>
<style>
    *{
        margin-left: 10px;
        padding: 3px;
    }
    .tip{

        height:30px;
        text-align: right;
        background-color: #F5F5F5;
    }
</style>
<body>
<form id="newCustomer" method="post">
    <input type="hidden" name="customerVO.id" value="${customerVO.id }">
    <input type="hidden" name="customerVO.isDeleted" value="${false}">
    <input type="hidden" name="customerVO.isLocked" value="${false }">
    <input type="hidden" name="customerVO.contactId" value="${customerVO.contactId }">
    <input type="hidden" name="customerVO.contactCreateUserId" value="${customerVO.contactCreateUserId }">
    <input type="hidden" name="customerVO.contactCreateTime" value="${customerVO.contactCreateTime }">
    <input type="hidden" name="customerVO.createUserId" value="${customerVO.createUserId }">
    <input type="hidden" name="customerVO.createTime" value="${customerVO.createTime}">
    <table>
        <tr>
            <td colspan="4">主要信息</td>
        </tr>
        <tr>
            <td class="tip">负责人：</td>
            <td>
                <select id="owner" name="ownerUserId" style="width:146px;height:32px" data-options="required:true">
                    <option>--请选择--</option>
                    <option th:each="users:${userList}" th:value="${users.id}" th:text="${users.username}"></option>
                </select>&nbsp;<a href="javascript:void(0);" class="easyui-linkbutton button-white">放入客户池</a></span></td>
            <td class="tip">客户名称：</td>
            <td><input name="name" class="easyui-textbox easyui-validatebox" data-options="validType:['chinese'],required:true"/></td>
        </tr>
        <tr>
            <td class="tip">客户行业：</td>
            <td><input name="industry" class="easyui-textbox easyui-validatebox" data-options="required:true"/></td>
            <td class="tip">客户信息来源：</td>
            <td><input name="origin" class="easyui-textbox easyui-validatebox" data-options="required:true"/></td>
        </tr>
        <tr>
            <td class="tip">公司性质：</td>
            <td><input type="radio" value="合资"  name="ownership">合资
                <input type="radio" value="国企"  name="ownership">国企
                <input type="radio" value="民营"  name="ownership">民营</td>
            <td class="tip">邮编：</td>
            <td><input name="zipCode" class="easyui-textbox easyui-validatebox" data-options="validType:['zipCode'],required:true"/></td>
        </tr>
        <tr>
            <td class="tip">年营业额：</td>
            <td><select class="easyui-combobox" name="annualRevenue" style= "width:146px">
                <option value="-1">-请选择-</option>
                <option value="1000万-3000万">1000万-3000万</option>
                <option value="3000万-6000万">3000万-6000万</option>
                <option value="6000万-9000万">6000万-9000万</option>
            </select></td>
            <td class="tip">评分：</td>
            <td><input type="radio" value="一星" name="rating">一星&nbsp;
                <input type="radio" value="两星" name="rating">二星&nbsp;
                <input type="radio" value="三星" name="rating">三星</td>
        </tr>
        <tr>
            <td class="tip">客户联系地址：</td>
            <td colspan="3">
                <input id="addr1"class="easyui-textbox easyui-validatebox" style="width:100px" data-options="prompt:'省',required:true">
                <input id="addr2" class="easyui-textbox easyui-validatebox" style="width:100px" data-options="prompt:'市',required:true">
                <input id="addr3" class="easyui-textbox easyui-validatebox" style="width:100px" data-options="prompt:'区',required:true">
                <input id="addr4" class="easyui-textbox easyui-validatebox" data-options="prompt:'具体街道信息',required:true">
                <input id="address" name="address" type="hidden">
            </td>
        </tr>
        <tr><td colspan="4">首要联系人信息</td></tr>
        <tr>
            <td class="tip">姓名：</td>
            <td><input name="csname" class="easyui-textbox easyui-validatebox" data-options="required:true"></td>
            <td class="tip">称呼：</td>
            <td><input name="saltname" class="easyui-textbox easyui-validatebox" data-options="required:true"></td>
        </tr>
        <tr>
            <td class="tip">邮箱：</td>
            <td><input name="email" class="easyui-textbox easyui-validatebox" data-options="required:true,validType:'email'"></td>
            <td class="tip">职位：</td>
            <td><input name="post" class="easyui-textbox easyui-validatebox" data-options="required:true"></td>
        </tr>
        <tr>
            <td class="tip">QQ：</td>
            <td><input name="qqNo" class="easyui-textbox easyui-validatebox" data-options="required:true,validType:['integer']"></td>
            <td class="tip">手机：</td>
            <td><input name="telephone"  class="easyui-textbox easyui-validatebox" data-options="required:true,validType:['mobile']"></td>
        </tr>
        <tr>
            <td class="tip">备注：</td>
            <td colspan="3">
                <textarea name="description" class="easyui-textbox" data-options="multiline:true" style="width:579px;height:60px;"></textarea>
            </td>
        </tr>
<!--        <tr>
            <td colspan="4">附加信息</td>
        </tr>
        <tr>
            <td class="tip">员工数：</td>
            <td colspan="3"><input  class="easyui-textbox" name=""></td>
        </tr>-->
       <!-- <tr>
            <td class="tip">备注：</td>
            <td colspan="3">
                <textarea class="easyui-textbox" name="" data-options="multiline:true" style="width:579px;height:60px;"></textarea>
            </td>
        </tr>-->
        <tr>
            <td colspan="4" style="text-align: center;">
                <!--<a id="save" href="javascript:void(0);" class="easyui-linkbutton button-purple" >保存</a>-->
                <a id="save" href="javascript:void(0);" class="easyui-linkbutton button-purple" >保存</a>
                <a id="submit" href="javascript:void(0);" class="easyui-linkbutton button-pink" >保存并新建</a>
                <input class="easyui-checkbox" type="checkbox" name="" value="">同时创建商机
            </td>
        </tr>
    </table>
</form>
</body>
<script type="text/javascript">
    $(function(){
        // $.post("system/user/UserAction_findAll.action",function(data){
        /*$.post("/cu",function(data){
        alert("sss")
        if(data&&data.success){
            var ownerId = "${customerVO.ownerId}";
            $.each(data.data,function(index,obj){
                var option = $("<option value='"+obj.id+"' >"+obj.username+"</option>")
                if(ownerId == obj.id){
                    option.prop("selected",true);
                }
                $("#owner").append(option);
            })
        }
    },"json")*/
        //修改回显地址
        var address = "";
        address = address.split("-");
        $("#addr1").textbox({"value":address[0]});
        $("#addr2").textbox({"value":address[1]});
        $("#addr3").textbox({"value":address[2]});
        $("#addr4").textbox({"value":address[3]});

        // $("#submit").on("click",function(e){
        $("#save").on("click",function(e){
            var addr1 = $("#addr1").val();
            var addr2 = $("#addr2").val();
            var addr3 = $("#addr3").val();
            var addr4 = $("#addr4").val();
            var addr = addr1+"-"+addr2+"-"+addr3+"-"+addr4;
            $("#address").val(addr);

            $.post("insert",
                $("#newCustomer").serialize(),
                function(data){
                    $.messager.alert({
                        title:"提示",
                        msg:data.msg,
                    })
                    // location.href = "/toList";
                },"json")

            /*$("#newCustomer").form("submit",{
                url:"manage/customer/CustomerAction_saveOrUpdate.action",
                onSubmit:function(){
                    return $(this).form("validate");
                },

                success:function(data){
                    var tdata=eval("("+data+")");
                    if(tdata&&tdata.success){
                        parent.parent.$("#topWindow").window("close");
                    }
                }
            })*/

        })
    })
</script>
</html>